package com.ccl.iot.managers;import android.graphics.Bitmap;

import com.ccl.iot.privates.BitmapStorer;

public class ImageManager {
	private static ImageManager gDefault = null;
	
	public static void Initialize(String aPath){
		if (gDefault == null){
			gDefault = new ImageManager(aPath);
		}
	}
	
	public static boolean ContainsBitmap(String aID){
		if (gDefault != null){
			return gDefault.containsBitmap(aID);
		}
		
		return false;
	}
	
	public static Bitmap GetBitmap(String aID){
		if (gDefault != null){
			return gDefault.getBitmap(aID);
		}
		
		return null;
	}
	
	public static boolean SetBitmap(String aID, Bitmap aBitmap){
		if (gDefault != null){
			return gDefault.setBitmap(aID, aBitmap);
		}
		
		return false;
	}
	
	public static boolean RemoveBitmap(String aID){
		if (gDefault != null){
			return gDefault.removeBitmap(aID);
		}
		
		return false;
	}
	
	/*
	 * 	Non-static functions
	 */
	private BitmapStorer iStorer = null;
	
	private ImageManager(String aPath){
		iStorer = new BitmapStorer(aPath + "Images");
	}
	
	public boolean containsBitmap(String aID){
		return iStorer.contains(aID);
	}
	
	public Bitmap getBitmap(String aID){
		return iStorer.get(aID);
	}
	
	public boolean setBitmap(String aID, Bitmap aBitmap){
		return iStorer.put(aID, aBitmap);
	}
	
	public boolean removeBitmap(String aID){
		return iStorer.remove(aID);
	}
}
